import request from '@/utils/request'

// 查询协议类型列表
export function listProtocolType(query) {
  return request({
    url: '/rms/protocol/type/',
    method: 'get',
    params: query
  })
}

// 查询协议类型详细
export function getProtocolType(id) {
  return request({
    url: `/rms/protocol/type/${id}/`,
    method: 'get'
  })
}

// 查询协议类型详细历史
export function getHistory(id) {
  return request({
    url: `/rms/protocol/type/${id}/history/`,
    method: 'get',
  })
}

// 新增协议类型
export function addProtocolType(data) {
  return request({
    url: '/rms/protocol/type/',
    method: 'post',
    data: data
  })
}

// 修改协议类型
export function updateProtocolType(data) {
  return request({
    url: `/rms/protocol/type/${data.id}/`,
    method: 'put',
    data: data
  })
}

// 删除协议类型
export function delProtocolType(id) {
  return request({
    url: `/rms/protocol/type/${id}/`,
    method: 'delete'
  })
}

// 获取协议树型节点数据
export function treeselect(query) {
  return request({
    url: '/rms/protocol/type/treeselect/',
    method: 'get',
    params: query
  })
}